package com.rc.pojo.po;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.JacksonTypeHandler;
import com.rc.common.model.BaseConEntity;
import com.rc.common.model.BaseImgEntity;
import com.rc.common.model.ImageModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 评论表 实体类。
 *
 * @author 27806
 * @since 2024-06-15
 */
@Data
@Builder
@Table(value = "comment", schema = "rc")
@NoArgsConstructor
@AllArgsConstructor
public class Comment implements BaseConEntity, BaseImgEntity,Serializable  {

    @Serial
    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Auto)
    private Long id;

    private String content;

    private Integer score;

    @Column(typeHandler = JacksonTypeHandler.class)
    private List<ImageModel> imgs;

    /**
     * 对应表的id
     */
    private Long itemId;

    /**
     * 0农庄评价 1活动评价 2商品评价
     */
    private Integer type;

    /**
     * 冗余字段 评论用户名 用户更新信息后会刷新
     */
    private String nickName;

    /**
     * 冗余字段 评论头像 用户更新信息后会刷新
     */
    private String avatar;

    @Column(onInsertValue = "now()")
    private LocalDateTime createTime;

    @Column(onInsertValue = "now()", onUpdateValue = "now()")
    private LocalDateTime updateTime;

    /**
     * 浏览量
     */
    private Long views;

    private Long conId;

    @Column(tenantId = true)
    private Long farmId;

}
